package com.epam.task.web.util;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class PropertyReader {
    private Properties props = new Properties();

    public String sql(String key) {
        try {
            FileInputStream ins = new FileInputStream(
                    "properties/sql");
            props.load(ins);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return props.getProperty(key);
    }

    public String dbconfig(String key) {
        try {
            FileInputStream ins = new FileInputStream(
                    "properties/dbconfig");
            props.load(ins);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return props.getProperty(key);
    }
}
